import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { WxUserForm, WxUserQuery, WxUserVo } from '@/api/wx/model/userModel';
import { request } from '@/utils/request';

// 查询微信用户列表
export function listUser(query?: WxUserQuery) {
  return request.get<TableDataInfo<WxUserVo>>({
    url: '/wx/user/list',
    params: query,
  });
}

// 查询微信用户详细
export function getUser(id: number) {
  return request.get<R<WxUserVo>>({
    url: `/wx/user/${id}`,
  });
}

// 新增微信用户
export function addUser(data: WxUserForm) {
  return request.post<R<void>>({
    url: '/wx/user',
    data,
  });
}

// 修改微信用户
export function updateUser(data: WxUserForm) {
  return request.put<R<void>>({
    url: '/wx/user',
    data,
  });
}

// 删除微信用户
export function delUser(ids: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/wx/user/${ids}`,
  });
}
